var wineApp = wineApp || {};
wineApp.cert = (function() {
    var initPage = function() {
        loadCert();
        initEvent();
    }

    var loadCert = function() {
        var ajaxUrl = wineApp.CONFIG.API.myqrurl;
        wineApp.ajax.post(ajaxUrl, {})
            .done(function(data) {
                if (data.certificateUrl) {
                    $('.mui-table-view-cell img').attr('src', data.certificateUrl);
                } else {
                    $('.mui-card').addClass('wine_hidden');
                    $('.wine_not_found').removeClass('wine_hidden');
                }
            }).fail(function(data) {
                $('.mui-card').addClass('wine_hidden');
                $('.wine_not_found').removeClass('wine_hidden');
            });
    }

    initEvent = function() {
        wineApp.tool.saveImgToLocalExt('img');
    }

    return {
        initPage: initPage
    }
})();

$(document).ready(function() {
    //$('.wine_footer').remove();
    wineApp.common.initHeaderIcon(0, true, {
        camera: false,
        search: false
    });
    wineApp.cert.initPage();
    //wineApp.common.initTabs('#tabs');
});